/*
 * @Description:
 * @version:
 * @Author: 尹鹏孝
 * @Date: 2023-07-08 16:02:28
 * @LastEditors: 尹鹏孝
 * @LastEditTime: 2024-04-15 11:16:31
 */
import { Module,MiddlewareConsumer  } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { AuthModule } from './auth/auth.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entity/user.entity';
import { UserDetail } from 'src/entity/userDetail.entity';
import { LoginModule } from './login/login.module';
import { UsersModule } from './users/users.module';
import { BaseArea } from 'src/entity/baseArea.entity';
import { BaseAreaModule } from './baseArea/base-area/base-area.module';
import { DepartmentsModule } from './departments/departments.module';
import { Departments } from './entity/departments.entity';
import { DocModule } from './files/doc/doc.module'
import { ExcelModule} from './files/excel/excel.module'
import { PdfModule } from './files/pdf/pdf.module'
import { WorldModule} from './files/world/world.module'
import { PdfService } from './pdf/pdf.service';
import { OwnerModule } from './owner/owner.module';
import { UploadModule } from './upload/upload.module';
import { CustomLoggerModule } from './custom-logger/custom-logger.module';
import { LoggerMiddleware } from './custom-logger/custom-logger.middleware';
import { SseModule } from './sse/sse.module';
import { databaseConfig } from './config/database.config';
import { RolesModule } from './roles/roles.module';
import { MenusModule } from './menus/menus.module';
import { DictionaryModule } from './dictionary/dictionary.module';

import { ProductModule } from './product/product.module';
import { InventoryModule } from './inventory/inventory.module';
import { InventoryLogModule } from './inventory-log/inventory-log.module';
import { OrderModule } from './order/order.module';
import { OrderNumberService } from './order-number/order-number.service';
import { PaymentModule } from './payment/payment.module';
import { FormatService } from './format/format.service';
import { StaticModule } from './static/static.module';

@Module({
  imports: [
    TypeOrmModule.forRoot(databaseConfig

    ),
    //连表查询
    TypeOrmModule.forFeature([User]),
    UsersModule,
    LoginModule,
    AuthModule,
    BaseAreaModule,
    DepartmentsModule,
    DocModule,
    ExcelModule,
    PdfModule,
    WorldModule,
    OwnerModule,
    UploadModule,
    CustomLoggerModule,
    SseModule,
    RolesModule,
    MenusModule,
    DictionaryModule,
    ProductModule,
    InventoryModule,
    InventoryLogModule,
    OrderModule,
    PaymentModule,
    StaticModule
  ],

  controllers: [AppController],
  providers: [AppService, PdfService,LoggerMiddleware, OrderNumberService, FormatService],
})
export class AppModule {
   configure(consumer: MiddlewareConsumer) {
    consumer.apply(LoggerMiddleware).forRoutes('*');
  }
}
